{{- if or (not .Values.dashboard.auth.externalAuthentication) (eq (include "helm_lib_module_https_mode" .) "Disabled") }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: access-to-dashboard-http
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "dashboard")) | nindent 2 }}
rules:
- apiGroups: ["apps"]
  resources: ["deployments/http"]
  resourceNames: ["dashboard"]
  verbs: ["get", "create", "update", "patch", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: access-to-dashboard-http
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "dashboard")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: access-to-dashboard-http
subjects:
- kind: Group
  name: ingress-nginx:auth
{{- end }}
